package com.blog.utils;

import java.util.ArrayList;
import java.util.List;

public class ResultInfo {
	private Object result = null;// 执行结果
	private List<String> msgs = new ArrayList<String>();
	private boolean isSuccess = false;// 是否成功
	private int state = 0;// 返回状态，用于捕获自定义消息

	public ResultInfo() {

	}

	public ResultInfo(boolean isSuccess, int state, List<String> msgs) {
		this.isSuccess = isSuccess;
		this.state = state;
		this.msgs = msgs;
	}

	public ResultInfo(boolean isSuccess, int state, String msg) {
		this.isSuccess = isSuccess;
		this.state = state;
		this.msgs.add(msg);
	}

	public ResultInfo(boolean isSuccess, int state, String msg, Object result) {
		this.isSuccess = isSuccess;
		this.msgs.add(msg);
		this.state = state;
		this.result = result;
	}

	public ResultInfo(boolean isSuccess, int state, List<String> msgs,
			Object result) {
		this.isSuccess = isSuccess;
		this.msgs = msgs;
		this.state = state;
		this.result = result;
	}
	
	public void addMsg(String msg){
		this.msgs.add(msg);
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	public boolean isSuccess() {
		return isSuccess;
	}

	public void setSuccess(boolean isSuccess) {
		this.isSuccess = isSuccess;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public List<String> getMsgs() {
		return msgs;
	}

	public void setMsgs(List<String> msgs) {
		this.msgs = msgs;
	}
}
